package com.xyy.saas.payment.pojo.dto;

import com.xyy.saas.payment.exception.PaymentException;
import com.xyy.saas.payment.manage.cores.enums.ResultCodeEnum;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author wangzeqi
 */
@Data
public class ProfitSharingSettleDTO implements Serializable {

    private static final long serialVersionUID = 4459544812142069785L;

    private String payNo;
    private String amount;

    public void checkParam() throws PaymentException {
        if (StringUtils.isBlank(payNo) || StringUtils.isBlank(amount) || !NumberUtils.isCreatable(amount) || new BigDecimal(amount).compareTo(BigDecimal.ZERO) <= 0) {
            throw new PaymentException(ResultCodeEnum.PARAM_ERROR);
        }
    }

}
